#!/bin/bash
echo "Start of build_ffmpeg.sh"

mkdir /tmp/build
cd /tmp/build

echo "Getting dependencies"
apt-get -y install build-essential fakeroot dpkg-dev
apt-get -y install ffmpeg libogg libogg-dev libtheora libtheora-dev zlib1-dev

echo "Building ffmpeg with x11grab support"

apt-get -y source ffmpeg
apt-get -y build-dep ffmpeg

dpkg-source -x ffmpeg_0.cvs20070307-5ubuntu7.6.dsc

echo "Compiling ffmpeg"
cd /tmp/build/ffmpeg-0.cvs20070307
./configure --disable-altivec --disable-ffplay --disable-ffserver --disable-debug --disable-shared \
            --enable-gpl --enable-pthreads --enable-libogg --enable-libtheora --enable-swscaler --enable-x11grab

make

echo "Copying ffmpeg to /usr/bin"
cp ffmpeg /usr/bin

echo "Cleaning up"
cd /tmp
rm -rf /tmp/build

echo "End of script build_ffmpeg.sh"

